<%@ page language="java"  pageEncoding="utf-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";

String jpg="topbg.jpg";
//jpg=equest.getParameter("jpg");
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
  		<style type="text/css">
  		
  		
		body { margin:0px auto; padding:0px;}
		#top{ width:100%; height:75px; background:url(<%=basePath%>images/top/images/<%=jpg%>) repeat-x; position:relative}
		.logo_left{ width:713px; height:75px; float:left; background:url(<%=basePath%>images/top/images/logo_left.jpg) no-repeat;}
		.exit_button{ width:86px; height:29px; position:absolute; top:30px; right:50px; border:0px;}
		</style>
		<link rel="stylesheet" type="text/css" href="<%=basePath%>js/jquery/themes/default/easyui.css">
		<link rel="stylesheet" type="text/css" href="<%=basePath%>js/jquery/themes/icon.css">
		<script type="text/javascript" src="<%=basePath%>js/jquery/jquery-1.7.2.min.js"></script>
		<script type="text/javascript" src="<%=basePath%>js/jquery/jquery.easyui.min.js"></script>
		<script type="text/javascript" src="<%=basePath%>js/jquery/locale/easyui-lang-zh_CN.js"></script>
  		<script type="text/javascript" src="<%=basePath%>js/ztree/js/jquery.ztree.core-3.5.js"></script>
 	    <link rel="stylesheet" href="<%=basePath%>js/ztree/css/zTreeStyle/zTreeStyle.css" type="text/css">
 	    
 	    
 	    
 	    
 	    <script type="text/javascript">
 	    	
 	    	
 	     	
 	    	var setting = {
			async: {
			
				enable: true,
				url: "<%=basePath %>menu/getMenuByUser.xhtml" 
			},
			
			data: {
				simpleData: {
					enable: true,
					idKey: "id",
					pIdKey:"pid"
				}
			},
			callback:{
			onAsyncSuccess:zTreeOnAsyncSuccess
			}
			
		};
		var firstAsyncSuccessFlag = 0;
  	function zTreeOnAsyncSuccess(event, treeId, msg) { 
    if (firstAsyncSuccessFlag == 0) {    
        	var treeObj = $.fn.zTree.getZTreeObj("treeMenu");
			treeObj.expandAll(true);
			firstAsyncSuccessFlag = 1;
		 	
		 }
		 }
		function treeOnClick(url,titleName,id)
		{
		//alert(url+","+titleName+","+id);
			if(!url)
			{
				return ;
			}
			if($("#tabPanel").tabs("exists",titleName))
	 		{
	 		$('#tabPanel').tabs('select',titleName);
	 		}else {
	 		$('#tabPanel').tabs('add',{
	 			
	 			closable:true,
	 			content:"<iframe scrolling='no'  id = 'tab"+id+"' frameborder='0'  src='"+url+"' style='width:100%;height:100%;'></iframe>",
	 			title : titleName,
	 			tools:[{
	 				iconCls: "icon-mini-refresh" ,
	 				handler: function (){
	 				document.getElementById("tab"+id).src = document.getElementById("tab"+id).src;
	 				}
	 			}]
	 		});
	 		}
		}
		
		function setCheck() {
			$.fn.zTree.init($("#treeMenu"), setting, null);
			
		}
		$(document).ready(function (){
			setCheck();
		});
		
		
		function logout(){
			if(confirm("你确定要退出吗？")){
				location = "<%=basePath%>/sys/login/logout.action?page="+document.getElementById("loginpage").value;
			}
		}
		
		
		function message(){
			     $.ajax({
				url:'<%=basePath%>/sys/login/weblogin!message.action',
				type:"post",
				success:function (data){
				//alert(1);
					var json = eval(data);
					//alert(1);
						if(!json.state)
						{
							//alert(json.msg+11111111);
						}else {
							if(json.total>0){
								 $.messager.show({
								 								           
							                title:'监测点有异常情况，请注意查看！',
							                msg:'<a onclick="treeOnClick(\'<%=basePath%>web/monitordatacollection/arrangementDataCollectionMap.jsp\',\'监控点状态\',\'92\')"><font color=Blue><U>查看监控点状态</U></font></a> <br> <br> <a  onclick="treeOnClick(\'<%=basePath%>web/monitordatacollection/arrangementDataCollectionList.jsp\',\'查看监控数据\',\'91\')"><font color=Blue><U>查看监控点数据</U></font></a>',
							                timeout:5000,
							                showType:'show'
							            });
								 // alert(json.msg+222222);
							}	
							 
						}
					}
				});
		}

	$(document).ready(function (){
	     message();
	});
		
 	    </script>
  </head>
  
  <body class="easyui-layout" >
  		<div region="west" split="true" title="导航栏" style="width: 200px; padding: 1px;">
  			<div id = "treeMenu" class="ztree" ></div>
		</div>
		
		<div region="center" split="true"  title="欢迎${user.username } 使用${user.title }"  id="title">
			<div id="tabPanel" class="easyui-tabs" border="false" fit="true"></div>
		</div>
		<div region = "north"  style = "height: 83px;" >
			<div id="top">
	<div class="logo_left"><img alt="logo_left" src="<%=basePath %>images/logo_left_1.png" /></div>
    <div class="exit_button"><input type="submit" name="" value="" onclick="logout()" style=" width:86px; height:29px; background:
    	url(<%=basePath%>images/top/images/exit_button.jpg) no-repeat; border:0px; cursor:pointer;">
    	
    </div> 
		</div>
  </body>
</html>
